package com.liuyi.mybatisplus.pagehelper;

import com.github.pagehelper.PageHelper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * @author Mr.fmy
 * @version 1.0.0
 * @ClassName PageHelperConfig
 * @Description TODO PageHelper配置类
 * @createTime 2019/9/16 14:43
 */
@Configuration
public class PageHelperConfig {

    @Bean
    public PageHelper pageHelper() {
        PageHelper pageHelper = new PageHelper();
        Properties properties = new Properties();
        properties.setProperty("offsetAsPageNum", "true");
        properties.setProperty("rowBoundsWithCount", "true");
        properties.setProperty("reasonable", "true");
        properties.setProperty("dialect", "mysql");   //配置mysql数据库的方言
        pageHelper.setProperties(properties);
        return pageHelper;
    }
}
